package com.mjk.common.web.getway.conf.selector;


import com.mjk.common.web.getway.transfer.cloud.CloudGetWayProtocol;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

import static org.springframework.beans.factory.support.BeanDefinitionBuilder.rootBeanDefinition;

public class BeeCloudTransferRegistrar implements ImportBeanDefinitionRegistrar{
	@Override
	public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata,BeanDefinitionRegistry registry) {
		BeanDefinitionBuilder builder = rootBeanDefinition(CloudGetWayProtocol.class);
        
        builder.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
        AbstractBeanDefinition beanDefinition = builder.getBeanDefinition();
        String cloudName = "beeCloudPrototal";
        registry.registerBeanDefinition(cloudName, beanDefinition);
	}
}
